<%@ page language="java"
         import="com.ruohi.manage.DBType,com.ruohi.manage.PoolManager,com.ruohi.util.common.CommonForm,com.ruohi.util.common.CommonString,com.ruohi.util.common.Env"
         pageEncoding="UTF-8" %>
<%@ page import="com.ruohi.util.dbutil.DBHelper" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%
	String resDomain = Env.getInstance().getProperty("img_domain");
	Connection connection = null;
	String tablePrefix = Env.getInstance().getProperty("table_prefix");
	DBHelper dbHelper = DBHelper.getInstance();
	Map model = new HashMap();
	String tableName = " gift_index_banner ";
	try{
		connection = PoolManager.getConnection(DBType.getDBTypeByEnum("106013"));
		String id = CommonString.getFormatPara(request.getParameter("id"));
		String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
		if(null!=id&&!"".equals(id)){
			model = dbHelper.getMap(" select * from "+tableName+" where uuid = ? ",new Object [] {id} , connection);
		}
		if("".equals(channelUUID)&&null!=model){
			channelUUID = (String)model.get("channel_uuid");
		}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=Env.getInstance().getProperty("project_name") %></title>
<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_all_min.js"></script>
<link rel="stylesheet" type="text/css" href="/plugin/editor/ueditor/themes/default/ueditor.css"/>
<style type="text/css">
</style>
</head>

<body style=" style="margin:0;padding:0;">
<form name="theform" id="theform" action="/backend/action/crud.jsp?enumNo=106013">
  <div class="formDiv">
  	<div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">基础信息</span> </div>
    <div class="formLeft">banner标题</div>
    <div class="formRight" style="width:190px">
        <input type="text" class="jr_text" name="zd_banner_title" id="zd_banner_title" value="<%=CommonString.getFormatPara(model.get("banner_title")) %>" />
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">banner链接</div>
    <div class="formRight" style="width: 550px; text-align:left;">
    	<input type="text" style="width:320px;" class="jr_text" name="zd_link_url" id="zd_link_url" value="<%=CommonString.getFormatPara(model.get("link_url")) %>" />(为空时，表示此banner没有连接)
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">banner图片</div>
    <div class="formRight" style="width: 350px; text-align:left;">
      <input type="text" style="width:350px;" readonly="true" dataType='Require' msg='banner图片不能为空！' class="jr_text" name="zd_banner_img" id="zd_banner_img" value="<%=CommonString.getFormatPara(model.get("banner_img")) %>" />
    </div>
    <div class="formRight" style="width: 30px; text-align:left;">
    	<a href="<%=CommonString.getFormatPara(model.get("banner_img")) %>" id="a_img" onclick='return hs.expand(this);'><img src="/backend/images/yulan.gif" /></a>
    </div>
    <div class="formRight" style="width: 50px; text-align:left;">
    	<span id="banner_img" style="float:right;"></span>
    </div>
    <div class="formRight" style="width: 50px; text-align:left;">
    	<span id="img_upload_msg" style="float:right; display:none; color:red;">上传成功</span>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">排序号</div>
    <div class="formRight" style="width:300px; text-align:left;">
      <input type="text" style="width:80px;" dataType='Integer' msg='请输入正确的排序号！' class="jr_text" name="zd_order_no" id="zd_order_no" value="<%=CommonString.getFormatPara(model.get("order_no")) %>" />(数字越大越靠前)
    </div>
  <div style="clear: left;"></div>
  <div class="formLeft">是否显示</div>
    <div class="formRight" style="width:190px">
      <%=CommonForm.createIsRadio(CommonString.getFormatInt(model.get("is_show")).toString(), "zd_is_show") %>
    </div>
  <div style="clear: left;"></div>
  <input type="hidden" name="tableName" id="tableName" value="<%=tableName %>" />
  <input type="hidden" name="zd_id" id="zd_id" value="<%=CommonString.getFormatPara(model.get("id")) %>" />
</form>
</body>
</html>
<script type="text/javascript" src="/plugin/jquery/jquery.form.js"></script>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://img.52sdskj.com/plugin/upload/jr_upload.js"></script>
<script src="/backend/scripts/common.js" prefix="<%=tablePrefix %>" type="text/javascript"></script>
<script type="text/javascript" src="/plugin/other/highslide/highslide.min.js"></script>
<script src="/plugin/validator/wofoshan/validator.min.js" type="text/javascript"></script>
<script type="text/javascript">
	function doSub(dialog){
		var rs = Validator.Validate(document.getElementById("theform"),1);
		if(rs){
			jQuery("#theform").ajaxSubmit({
				type : "POST",
				async : false ,
				success : function(data) {
					var rs = parseInt(jQuery.trim(data), 10);
					if (rs > 0 ) {
						window.parent.jQuery.ligerDialog.success("保存成功！", "提示", function(){
							dialog.close();
						});
					} 
				}
			});
		}
	}
	
	$(function(){
		hs.graphicsDir = '/plugin/other/highslide/graphics/';
		hs.wrapperClassName = 'wide-border';
		
		jQuery("#banner_img").JrUpload({
            remotUrl: "http://img.52sdskj.com/upload.jsp",
			folder : "saygou" ,
			watermark:false,
			multi:false,
			isResize:false,
			callback : "setBannerImg"
		});
	});
	
	function setBannerImg(data){
		if(data != ""){
			$("#zd_banner_img").val("<%=resDomain %>" + data);
			jQuery("#a_img").attr("href","<%=resDomain %>" + data);
			$("#img_upload_msg").show();
			$("#img_upload_msg").delay(3000).hide(0);
		}
	}
</script>
<%
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		dbHelper.freeConnection(connection);
	}
%>